import {CoverImage, View, Form, Input, Button } from '@tarojs/components'
import Taro from "@tarojs/taro";
import {Component} from "react";

import './login.scss'

class Login extends Component {
  onReady() {
    console.log('onReady')
  }
  formSubmit = e => {
    console.log(e)
    Taro.navigateTo({
      url: '/pages/home/index?id=1',
      events: {
        // 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
        acceptDataFromOpenedPage: function (data) {
          console.log(data)
        },
        someEvent: function (data) {
          console.log(data)
        }
      },
      success: function (res) {
        // 通过eventChannel向被打开页面传送数据
        res.eventChannel.emit('acceptDataFromOpenerPage', {data: 'test'})
      }
    }).then(() => {})
  }

  formReset = e => {
    console.log(e)
  }

  render() {
    return (
      <View className='bigbox'>
        <View className='biglogobox'>
          <View className='logobox'>
            <CoverImage className='img' src='src' />
            <View>
              <View>启航托管</View>
            </View>
          </View>
        </View>
        <View className='bottombox'></View>
        <View className='formbox'>
          <View className='box'>
            <View className='title'>手机号登录</View>
            <View className='form'>
              <Form onSubmit={this.formSubmit} onReset={this.formReset} >
                <View className='example-body'>
                  <View className='form-item'>
                    <CoverImage className='imgMin' src='src' />
                    <Input name='phone' type='text' placeholder='请输入手机号' />
                  </View>
                  <View className='form-item form-item-speend'>
                    <View className='sub-item-box'>
                      <CoverImage className='imgMin' src='src' />
                      <Input name='yzm' type='text' placeholder='请输入验证码' />
                    </View>
                    <View className='yzm'>获取验证码</View>
                  </View>
                  <View className='submitBtn'>
                    <Button form-type='submit'>
                      登录
                    </Button>
                  </View>
                </View>
              </Form>
            </View>
          </View>
        </View>
        <View className='footerbox'>
          <View className='b-box'>
            <View className='box1'>
              <View className='line'></View>
              <View className='qtLogin'>其它登录方式</View>
              <View className='line'></View>
            </View>
          </View>
          <View className='b-box'>
            <View className='box2'>
              <View className='icon'></View>
              <View className='text'>微信登录</View>
            </View>
          </View>
        </View>
      </View>
    )
  }
}

export default Login
